package com.iplant.pdm.service.po.fpc;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.iplant.base.po.BasePO;
import com.iplant.base.po.enums.DBSchemas;
import com.iplant.base.utils.annotation.po.DBBasePO;
import com.iplant.base.utils.annotation.condition.DBCondition;
import com.iplant.base.utils.annotation.field.DBField;
import com.iplant.base.utils.annotation.join.DBJoin;
import com.iplant.basic.service.basicenum.bfc.FMCShiftType;

import java.io.Serializable;

@DBBasePO(TableName = "fpc_capacity", Code = false, AutoCreateTable = true, Name = false,
        CheckName = {"ProductID,FactoryID,WorkshopID,WorkAreaID,StationID,ShiftType"}, Schemas =
        DBSchemas.PDM)
public class FPCCapacity extends BasePO implements Serializable {
    private static final long serialVersionUID = 1L;//序

    @DBCondition
    @DBField
    public int ProductID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fpc_product", tableAsName = "p1", Schemas = DBSchemas.PDM, MainTableField
            = "ProductID")
    public String ProductName = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fpc_product", tableAsName = "p1", Schemas = DBSchemas.PDM, MainTableField
            = "ProductID")
    public String ProductCode = "";


    @DBCondition
    @DBJoin(name = "ProductTypeID", tableName = "fpc_product", tableAsName = "p1", Schemas = DBSchemas.PDM,
            MainTableField = "ProductID")
    public int ProductTypeID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fpc_producttype", tableAsName = "p2", JoinIndex = 2, Schemas = DBSchemas.PDM,
            ConditionalJoin = "p1.ProductTypeID=p2.ID")
    public String ProductTypeCode = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fpc_producttype", tableAsName = "p2", JoinIndex = 2, Schemas = DBSchemas.PDM,
            ConditionalJoin = "p1.ProductTypeID=p2.ID")
    public String ProductTypeName = "";


    @DBCondition
    @DBField
    public int FactoryID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fmc_factory", tableAsName = "f1", JoinIndex = 3, Schemas = DBSchemas.Basic,
            MainTableField = "FactoryID")
    public String FactoryCode = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_factory", tableAsName = "f1", JoinIndex = 3, Schemas = DBSchemas.Basic,
            MainTableField = "FactoryID")
    public String FactoryName = "";

    @DBCondition
    @DBField
    public int WorkshopID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_workshop", tableAsName = "w1", Schemas = DBSchemas.Basic, MainTableField
            = "WorkshopID")
    public String WorkshopName = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fmc_workshop", tableAsName = "w1", Schemas = DBSchemas.Basic, MainTableField
            = "WorkshopID")
    public String WorkshopCode = "";

    @DBCondition
    @DBField
    public int WorkAreaID = 0;
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_workarea", tableAsName = "w2", MainTableField = "WorkAreaID")
    public String WorkAreaName = "";
    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fmc_workarea", tableAsName = "w2", MainTableField = "WorkAreaID")
    public String WorkAreaCode = "";


    @DBCondition
    @DBField
    public int StationID = 0;

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Name", tableName = "fmc_station", tableAsName = "s1", MainTableField = "StationID")
    public String StationName = "";

    @DBCondition(CompareType = DBCondition.DBCompareType.like)
    @DBJoin(name = "Code", tableName = "fmc_station", tableAsName = "s1", MainTableField = "StationID")
    public String StationCode = "";

    /**
     * 班次类型
     */
    @DBCondition
    @DBField
    public int ShiftType = 0;


    public String ShiftTypeName="";


    /**
     * 允许混合生产
     */
    @DBField(DefaultValue = "'1‘")
    public int MixEnable = 1;


    /**
     * 允许混合生产产品种类数量
     */
    @DBField(DefaultValue = "'2'")
    public int MaxMixNumber = 2;

    /**
     * 产能是否互斥  不互斥绝对允许混合生产，且互不干扰
     */
    @DBField(DefaultValue = "'1'")
    public int MutexEnable = 1;



    /**
     * 削减后最小产能   若最后未达到最小产能 考虑往前一次合并，若超出后续支持最大产能或自身最大产能，则不合并
     */
    @DBField(DefaultValue = "'1'")
    public double CapacityMinNum=0.0;

    /**
     * 产能
     */
    @DBField
    public double CapacityNum = 0.0;

    @JsonProperty("ProductID")
    public int getProductID() {
        return ProductID;
    }

    public void setProductID(int productID) {
        ProductID = productID;
    }

    @JsonProperty("ProductName")
    public String getProductName() {
        return ProductName;
    }

    public void setProductName(String productName) {
        ProductName = productName;
    }

    @JsonProperty("ProductCode")
    public String getProductCode() {
        return ProductCode;
    }

    public void setProductCode(String productCode) {
        ProductCode = productCode;
    }

    @JsonProperty("ProductTypeID")
    public int getProductTypeID() {
        return ProductTypeID;
    }

    public void setProductTypeID(int productTypeID) {
        ProductTypeID = productTypeID;
    }

    @JsonProperty("ProductTypeCode")
    public String getProductTypeCode() {
        return ProductTypeCode;
    }

    public void setProductTypeCode(String productTypeCode) {
        ProductTypeCode = productTypeCode;
    }

    @JsonProperty("ProductTypeName")
    public String getProductTypeName() {
        return ProductTypeName;
    }

    public void setProductTypeName(String productTypeName) {
        ProductTypeName = productTypeName;
    }

    @JsonProperty("FactoryID")
    public int getFactoryID() {
        return FactoryID;
    }

    public void setFactoryID(int factoryID) {
        FactoryID = factoryID;
    }

    @JsonProperty("FactoryCode")
    public String getFactoryCode() {
        return FactoryCode;
    }

    public void setFactoryCode(String factoryCode) {
        FactoryCode = factoryCode;
    }

    @JsonProperty("FactoryName")
    public String getFactoryName() {
        return FactoryName;
    }

    public void setFactoryName(String factoryName) {
        FactoryName = factoryName;
    }

    @JsonProperty("WorkshopID")
    public int getWorkshopID() {
        return WorkshopID;
    }

    public void setWorkshopID(int workshopID) {
        WorkshopID = workshopID;
    }

    @JsonProperty("WorkshopName")
    public String getWorkshopName() {
        return WorkshopName;
    }

    public void setWorkshopName(String workshopName) {
        WorkshopName = workshopName;
    }

    @JsonProperty("WorkshopCode")
    public String getWorkshopCode() {
        return WorkshopCode;
    }

    public void setWorkshopCode(String workshopCode) {
        WorkshopCode = workshopCode;
    }

    @JsonProperty("WorkAreaID")
    public int getWorkAreaID() {
        return WorkAreaID;
    }

    public void setWorkAreaID(int workAreaID) {
        WorkAreaID = workAreaID;
    }

    @JsonProperty("WorkAreaName")
    public String getWorkAreaName() {
        return WorkAreaName;
    }

    public void setWorkAreaName(String workAreaName) {
        WorkAreaName = workAreaName;
    }

    @JsonProperty("WorkAreaCode")
    public String getWorkAreaCode() {
        return WorkAreaCode;
    }

    public void setWorkAreaCode(String workAreaCode) {
        WorkAreaCode = workAreaCode;
    }

    @JsonProperty("StationID")
    public int getStationID() {
        return StationID;
    }

    public void setStationID(int stationID) {
        StationID = stationID;
    }

    @JsonProperty("StationName")
    public String getStationName() {
        return StationName;
    }

    public void setStationName(String stationName) {
        StationName = stationName;
    }

    @JsonProperty("StationCode")
    public String getStationCode() {
        return StationCode;
    }

    public void setStationCode(String stationCode) {
        StationCode = stationCode;
    }

    @JsonProperty("ShiftType")
    public int getShiftType() {
        return ShiftType;
    }

    public void setShiftType(int shiftType) {
        ShiftType = shiftType;
    }

    @JsonProperty("MixEnable")
    public int getMixEnable() {
        return MixEnable;
    }

    public void setMixEnable(int mixEnable) {
        MixEnable = mixEnable;
    }

    @JsonProperty("MutexEnable")
    public int getMutexEnable() {
        return MutexEnable;
    }

    public void setMutexEnable(int mutexEnable) {
        MutexEnable = mutexEnable;
    }

    @JsonProperty("CapacityNum")
    public double getCapacityNum() {
        return CapacityNum;
    }

    public void setCapacityNum(double capacityNum) {
        CapacityNum = capacityNum;
    }
    @JsonProperty("MaxMixNumber")
    public int getMaxMixNumber() {
        return MaxMixNumber;
    }

    public void setMaxMixNumber(int maxMixNumber) {
        MaxMixNumber = maxMixNumber;
    }

    @JsonProperty("ShiftTypeName")
public String getShiftTypeName() {

        ShiftTypeName= FMCShiftType.getEnumType(ShiftType).getLabel();
        return ShiftTypeName;
    }
    @JsonProperty("ShiftTypeName")
    public void setShiftTypeName(String shiftTypeName) {
        ShiftTypeName = shiftTypeName;
    }
    @JsonProperty("CapacityMinNum")
    public double getCapacityMinNum() {
        return CapacityMinNum;
    }

    public void setCapacityMinNum(double capacityMinNum) {
        CapacityMinNum = capacityMinNum;
    }
}
